\(\int (a \cot (e+f x))^m (b \cot (e+f x))^n \, dx\) [41]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [F]
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 21, antiderivative size = 64 \[ \int (a \cot (e+f x))^m (b \cot (e+f x))^n \, dx=-\frac {(a \cot (e+f x))^{1+m} (b \cot (e+f x))^n \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (1+m+n),\frac {1}{2} (3+m+n),-\cot ^2(e+f x)\right )}{a f (1+m+n)} \]

[Out]

-(a*cot(f*x+e))^(1+m)*(b*cot(f*x+e))^n*hypergeom([1, 1/2+1/2*m+1/2*n],[3/2+1/2*m+1/2*n],-cot(f*x+e)^2)/a/f/(1+
m+n)

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 64, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {20, 3557, 371} \[ \int (a \cot (e+f x))^m (b \cot (e+f x))^n \, dx=-\frac {(a \cot (e+f x))^{m+1} (b \cot (e+f x))^n \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (m+n+1),\frac {1}{2} (m+n+3),-\cot ^2(e+f x)\right )}{a f (m+n+1)} \]

[In]

Int[(a*Cot[e + f*x])^m*(b*Cot[e + f*x])^n,x]

[Out]

-(((a*Cot[e + f*x])^(1 + m)*(b*Cot[e + f*x])^n*Hypergeometric2F1[1, (1 + m + n)/2, (3 + m + n)/2, -Cot[e + f*x
]^2])/(a*f*(1 + m + n)))

Rule 20

Int[(u_.)*((a_.)*(v_))^(m_)*((b_.)*(v_))^(n_), x_Symbol] :> Dist[b^IntPart[n]*((b*v)^FracPart[n]/(a^IntPart[n]
*(a*v)^FracPart[n])), Int[u*(a*v)^(m + n), x], x] /; FreeQ[{a, b, m, n}, x] &&  !IntegerQ[m] &&  !IntegerQ[n]
&&  !IntegerQ[m + n]

Rule 371

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[a^p*((c*x)^(m + 1)/(c*(m + 1)))*Hyperg
eometric2F1[-p, (m + 1)/n, (m + 1)/n + 1, (-b)*(x^n/a)], x] /; FreeQ[{a, b, c, m, n, p}, x] &&  !IGtQ[p, 0] &&
 (ILtQ[p, 0] || GtQ[a, 0])

Rule 3557

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Dist[b/d, Subst[Int[x^n/(b^2 + x^2), x], x, b*Tan[c + d
*x]], x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rubi steps \begin{align*} \text {integral}& = \left ((a \cot (e+f x))^{-n} (b \cot (e+f x))^n\right ) \int (a \cot (e+f x))^{m+n} \, dx \\ & = -\frac {\left (a (a \cot (e+f x))^{-n} (b \cot (e+f x))^n\right ) \text {Subst}\left (\int \frac {x^{m+n}}{a^2+x^2} \, dx,x,a \cot (e+f x)\right )}{f} \\ & = -\frac {(a \cot (e+f x))^{1+m} (b \cot (e+f x))^n \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (1+m+n),\frac {1}{2} (3+m+n),-\cot ^2(e+f x)\right )}{a f (1+m+n)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.16 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.02 \[ \int (a \cot (e+f x))^m (b \cot (e+f x))^n \, dx=-\frac {\cot (e+f x) (a \cot (e+f x))^m (b \cot (e+f x))^n \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (1+m+n),\frac {1}{2} (3+m+n),-\cot ^2(e+f x)\right )}{f (1+m+n)} \]

[In]

Integrate[(a*Cot[e + f*x])^m*(b*Cot[e + f*x])^n,x]

[Out]

-((Cot[e + f*x]*(a*Cot[e + f*x])^m*(b*Cot[e + f*x])^n*Hypergeometric2F1[1, (1 + m + n)/2, (3 + m + n)/2, -Cot[
e + f*x]^2])/(f*(1 + m + n)))

Maple [F]

\[\int \left (a \cot \left (f x +e \right )\right )^{m} \left (b \cot \left (f x +e \right )\right )^{n}d x\]

[In]

int((a*cot(f*x+e))^m*(b*cot(f*x+e))^n,x)

[Out]

int((a*cot(f*x+e))^m*(b*cot(f*x+e))^n,x)

Fricas [F]

\[ \int (a \cot (e+f x))^m (b \cot (e+f x))^n \, dx=\int { \left (a \cot \left (f x + e\right )\right )^{m} \left (b \cot \left (f x + e\right )\right )^{n} \,d x } \]

[In]

integrate((a*cot(f*x+e))^m*(b*cot(f*x+e))^n,x, algorithm="fricas")

[Out]

integral((a*cot(f*x + e))^m*(b*cot(f*x + e))^n, x)

Sympy [F]

\[ \int (a \cot (e+f x))^m (b \cot (e+f x))^n \, dx=\int \left (a \cot {\left (e + f x \right )}\right )^{m} \left (b \cot {\left (e + f x \right )}\right )^{n}\, dx \]

[In]

integrate((a*cot(f*x+e))**m*(b*cot(f*x+e))**n,x)

[Out]

Integral((a*cot(e + f*x))**m*(b*cot(e + f*x))**n, x)

Maxima [F]

\[ \int (a \cot (e+f x))^m (b \cot (e+f x))^n \, dx=\int { \left (a \cot \left (f x + e\right )\right )^{m} \left (b \cot \left (f x + e\right )\right )^{n} \,d x } \]

[In]

integrate((a*cot(f*x+e))^m*(b*cot(f*x+e))^n,x, algorithm="maxima")

[Out]

integrate((a*cot(f*x + e))^m*(b*cot(f*x + e))^n, x)

Giac [F]

\[ \int (a \cot (e+f x))^m (b \cot (e+f x))^n \, dx=\int { \left (a \cot \left (f x + e\right )\right )^{m} \left (b \cot \left (f x + e\right )\right )^{n} \,d x } \]

[In]

integrate((a*cot(f*x+e))^m*(b*cot(f*x+e))^n,x, algorithm="giac")

[Out]

integrate((a*cot(f*x + e))^m*(b*cot(f*x + e))^n, x)

Mupad [F(-1)]

Timed out. \[ \int (a \cot (e+f x))^m (b \cot (e+f x))^n \, dx=\int {\left (a\,\mathrm {cot}\left (e+f\,x\right )\right )}^m\,{\left (b\,\mathrm {cot}\left (e+f\,x\right )\right )}^n \,d x \]

[In]

int((a*cot(e + f*x))^m*(b*cot(e + f*x))^n,x)

[Out]

int((a*cot(e + f*x))^m*(b*cot(e + f*x))^n, x)